Read the window from the view hierarchy across the app#25716
Open
crazytonyli wants to merge 2 commits into
Open
Read the window from the view hierarchy across the app#25716crazytonyli wants to merge 2 commits into
crazytonyli wants to merge 2 commits into
Conversation
Collaborator
Generated by 🚫 Danger |
Contributor
|
| App Name | WordPress | |
| Configuration | Release-Alpha | |
| Build Number | 32924 | |
| Version | PR #25716 | |
| Bundle ID | org.wordpress.alpha | |
| Commit | 4f1fa0c | |
| Installation URL | 3qju4e0m2q01g |
Contributor
|
| App Name | Jetpack | |
| Configuration | Release-Alpha | |
| Build Number | 32924 | |
| Version | PR #25716 | |
| Bundle ID | com.jetpack.alpha | |
| Commit | 4f1fa0c | |
| Installation URL | 3l63ltockjnr8 |
aaf2125 to
4f1fa0c
Compare
jkmassel
requested changes
Jun 29, 2026
| } else { | ||
|
|
||
| self.stackViewTopConstraint.constant = [self defaultStackDesignMargin] + [[UIApplication sharedApplication] currentStatusBarFrame].size.height; | ||
| self.stackViewTopConstraint.constant = [self defaultStackDesignMargin] + self.window.windowScene.statusBarManager.statusBarFrame.size.height; |
Contributor
There was a problem hiding this comment.
Claude thinks that stackViewTopConstraint is actually unused entirely and can be removed 🤷
|
|
||
| let cell = tableConfiguration.postCell(in: tableView, for: indexPath) | ||
| cell.configure(with: viewModel, isCompact: isCompact) | ||
| cell.configure(with: viewModel, isCompact: isCompact, window: view.window) |
Contributor
There was a problem hiding this comment.
If you were to define a property like this:
private var coverSize: ImageSize {
let size = view.bounds.size // same as the window bounds, assuming fullscreen
let width = isCompact
? min(size.width, size.height) - ReaderStreamBaseCell.insets.left * 2
: ReaderPostCell.regularCoverWidth
return ImageSize(scaling: CGSize(width: width, height: width),
scale: traitCollection.displayScale)
}You could avoid passing the window around, and instead just pass around dimensions. That seems quite a bit simpler because the cell is more declarative/testable.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.


Note
The first commit just runs
swift-formatover the touched files; the actual change is the second one.Description
Part of dropping the app's global ways of reaching its window. Each of these consumers already has a live view when it runs, so it now reads the window (or its window scene) from its own view hierarchy instead of
UIApplication.mainWindowand thecurrentStatusBarFrame/currentStatusBarOrientationglobals. Behavior is unchanged: the app is single-window, so the local window is the same one the globals resolved to.The one site that needed more than a local read is
ReaderPostCell: its cover sizing runs for off-screen cells whose ownwindowis nil, so the window is now passed in through the cell's configure API fromReaderStreamViewController.